﻿namespace Blazor.Views.DeviceList.Modals;

public class DeviceEntryEditorOption
{
    [Flags]
    public enum EditType
    {
        Name = 1 << 0,
        Id = 1 << 1,
        All = Name | Id,
    }

    public string? Id { get; }
    public string? Description { get; }
    public EditType Type { get; }

    public DeviceEntryEditorOption(EditType type, string? id, string? description)
    {
        Type = type;
        Id = id;
        Description = description;
    }

    public static DeviceEntryEditorOption New()
    {
        return new DeviceEntryEditorOption(EditType.All, null, null);
    }

    public static DeviceEntryEditorOption ChangeDescription(string id, string oldDesc)
    {
        return new DeviceEntryEditorOption(EditType.Id, id, oldDesc);
    }

    public static DeviceEntryEditorOption ChangeAll(string oldId,  string oldDesc)
    {
        return new DeviceEntryEditorOption(EditType.All, oldId, oldDesc);
    }
}